import {createRouter, createWebHistory} from 'vue-router'
import Layout from '../layout/Index.vue'
import Layout2 from '../views/front/front.vue'
const routes = [
    {
        path:'/',
        component: Layout,
        redirect: '/dashboard',
        children:[
            {
                path: '/dashboard',
                component: () => import('../layout/dashboard/Index.vue'),
                // component: () => import('../views/Home.vue'),
                name: 'dashboard',
                meta: {
                    title: '首页',
                    icon:'#icondashboard'
                }
            }
        ]
    },
    {
        path:'/Home',
        name:'Home',
        component:()=>import('../views/Home.vue')
    },
    {
        path:'/Login',
        name:'Login',
        component:()=>import('../views/Login.vue')
    },
    {
        path:'/Text',
        name:'text',
        component:()=>import('../views/text.vue')
    },
    {
        path:'/Index',
        name:'Index',
        component:()=>import('../layout/Index.vue')
    },
    {
        path:'/password',
        name:'password',
        component:()=>import('../views/password.vue')
    },
    {
        path:'/main',
        component: Layout,
        redirect: '/main',
        children:[
            {
                path: '/main',
                component: () => import('../views/main.vue'),
                // component: () => import('../views/Home.vue'),
                name: 'main',
                meta: {
                    title: '首页',
                    icon:'#icondashboard'
                }
            }
        ]
    },
    {
        path:'/system',
        name:'system',
        component: Layout,
        meta: {
            title: "系统管理",
            icon: "el-icon-menu",
            role: ["sys:manage"]
        },
        children: [
            {
                path: '/userList',
                component: () => import('../views/Home.vue'),//这里!!!!!!!!!!!!!!
                name: "userList",
                meta: {
                    title: "用户管理",
                    icon: "el-icon-s-custom",
                    role: ["sys:user"]
                },
            },
            {
                path: "/roleList",
                component: () => import('../views/user.vue'),//!!!!!!!!!!!!!!
                name: "roleList",
                meta: {
                    title: "角色管理",
                    icon: "el-icon-document",
                    roles: ["sys:menu"]
                },
            },
            {
                path: "/menuList",
                component: () => import('../views/menu.vue'),//!!!!!!!!!!!!!!
                name: "menuList",
                meta: {
                    title: "物流管理",
                    icon: "el-icon-document",
                    roles: ["sys:menu"]
                },
            },
        ]
    },
    {
        path: "/memberRoot",
        component: Layout,
        name: "memberRoot",
        meta: {
            title: "业务管理",
            icon: "Setting",
            roles: ["sys:memberRoot"],
        },
        children: [
            {
                path: "/goodsType",
                component: () => import('../views/goods.vue'),//!!!!!!
                name: "goodsType",
                meta: {
                    title: "商品管理",
                    icon: "userFilled",
                    role: ["sys:goodsType"],
                },
            },
            {
                path: "/chartList",
                component: () => import('../views/lun.vue'),//!!!!!!
                name: "chartList",
                meta: {
                    title: "轮播图",
                    icon: "wallet",
                    role: ["sys:memberList"],
                },
            },
            {
                path: "/dataList",
                component: () => import('../layout/menu/DataList.vue'),//!!!!!!
                name: "dataList",
                meta: {
                    title: "数据报表",
                    icon: "wallet",
                    role: ["sys:myFee"],
                },
            },
        ],
    },
    {
        path: '/front',
        component: () => import('../views/front/main.vue'),
        children:[
            {
                path: "main2",
                name: "main2",
                component: () => import('../views/front/menu.vue'),
            },
            {
                path: "cart",
                name: "cart",
                component: () => import('../views/front/cart.vue'),
            },
            {
                path: "detail",
                name: "detail",
                component: () => import('../views/front/detail.vue'),
            },
            {
                path: "login",
                name: "login",
                component: () => import('../views/front/login.vue'),
            },
            {
                path: "order",
                name: "order",
                component: () => import('../views/front/order.vue'),
            }
        ]
    }
]

// const router = createRouter({
//     history: createWebHistory("/"),
//     routes:routes,
// })
const router = createRouter({
    history: createWebHistory("/"),
    routes:routes,
})



export default router;

